package com.lin.fengxiu.bo;

import lombok.Getter;
import lombok.Setter;

/**
 * @ClassName OrderMessageBO
 * @Description TODO 该类用于从订阅事件的name中反序列化取出couponId、orderId、userId
 * @Author wushaopei
 * @Date 2021/4/14 6:30
 * @Version 1.0
 */
@Getter
@Setter
public class OrderMessageBO {

    private Long orderId;
    private Long couponId;
    private Long userId;
    private String message;

    /**
     * @Description TODO 传入事件name
     * @param message
     */
    public OrderMessageBO(String message){
        this.message = message;
        this.parseId(message);
    }

    /**
     * @Description TODO 组装订阅的事件key
     * @param message
     */
    private void parseId(String message){
        String[] temp = message.split(",");
        this.userId = Long.valueOf(temp[0]);
        this.orderId = Long.valueOf(temp[1]);
        this.couponId = Long.valueOf(temp[2]);
    }
}
